﻿using CrawlerApp.Core.Entities;
using CrawlerApp.Core.Entities.BookAggregate;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CrawlerApp.Infrastructure.Data.Config
{
    public class AuthorConfiguration : IEntityTypeConfiguration<Author>
    {
        public void Configure(EntityTypeBuilder<Author> builder)
        {
            builder.HasIndex(b => b.Name)
                .IsUnique();

            builder
                .Property(b => b.Name)
                .IsRequired()
                .HasMaxLength(50);
        }
    }
}
